package com.example.springboot.controller;

import com.example.springboot.pojo.Base;
import com.example.springboot.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.springboot.pojo.Shop;

@RestController
@RequestMapping("/shop")
public class ShopController {



    @Autowired
    ShopService shopService;


    @RequestMapping("/findAll")
    public Base findAll(@RequestParam("page")Integer page,@RequestParam("size")Integer size) {
    return shopService.findAll(page,size);
    }

    @RequestMapping("/save")
    public Base save(@RequestBody Shop shop) {
        return shopService.save(shop);
    }


    @RequestMapping("/del")
    public Base del(@RequestBody Shop shop) {
        return shopService.del(shop);
    }


    @RequestMapping("/findById")
    public Base findById(@RequestParam int shopId) {
        return shopService.findById(shopId);
    }
}
